<html>
<?php include("../../MerchandiseBay/conn.php"); ?>
<head>
<?

$sqlMake="select make from make order by make";
$qryMake=mysql_query($sqlMake,$conn);

if (isset($_REQUEST['make']))
   {
     $make=$_REQUEST['make'];
     $sqlModel="select model from model where make='$make'";
     $qryModel=mysql_query($sqlModel,$conn);
   } 
else
 {$make="NONE";}
?>

<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Title</title>
<script language=javascript>
function getModel(model)
			{
				window.location.assign("carForm.php?make="+model);
			}
</script>

<script language="JavaScript">
function checkData ()
      {
            if (document.signup.make.value == "") {
                                        alert("Please select make!.")
                                        document.signup.make.focus()
                                        return false}
                                     
                                     if (document.signup.model.value == "") {
                                        alert("Please select model!.")
                                        document.signup.model.focus()
                                        return false}
                                        
                                        if (document.signup.reg.value == "") {
                                        alert("Please enter the registration no!.")
                                        document.signup.reg.focus()
                                        return false}
                                        
                                        if (document.signup.year.value == "") {
                                        alert("Please select year!.")
                                        document.signup.year.focus()
                                        return false}
                                        
                                        if (document.signup.owner.value == "") {
                                        alert("Please select owner!.")
                                        document.signup.owner.focus()
                                        return false}
                                        
                                        if (document.signup.mileage.value == "") {
                                        alert("Please enter mileage!.")
                                        document.signup.mileage.focus()
                                        return false}
                                        
                                        if (document.signup.price.value == "") {
                                        alert("Please enter some price!.")
                                        document.signup.price.focus()
                                        return false}
                           		
			  if (document.signup.remark.value==false) {
                                        alert("Please type in some description about this car!")
                                        document.signup.remark.focus()
                                        return false;}
                          
                        }
  

</script>
</head>

<body>

<div align="center">

<table border="0" width="73%" id="table1">
	<tr>
		
      <td background="../mc/images/background/menuE.gif" height="34"> <div align="center"><font size="2" face="Verdana">&nbsp;<strong><font size="3">Add 
          Merchandise</font></strong></font></div></td>
	</tr>
	<tr>
		<td>
		<table border="1" width="100%" bgcolor="#EEEEEE" style="border-collapse: collapse" bordercolor="#808080" id="table2">
			<tr>
				<td>
				<form method="POST" action="addCar.php"   name="signup" onSubmit="return checkData()" enctype="multipart/form-data">
					<p>&nbsp;&nbsp;&nbsp; </p>
					
                <p>&nbsp;<font size="2" face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Category 
                  : </font><font face="Verdana"> 
                  <select onChange="getModel(this.options[this.selectedIndex].text)" id="make" size="1" name="make">
					<? while($rowMake=mysql_fetch_assoc($qryMake)){
					if (strcmp ($make, $rowMake['make']) == 0)
					{ ?>
					<option selected><?=$rowMake['make']?></option>
					<?}
					else { ?>
					  <option><?=$rowMake['make']?></option>
					<?}}?>
					</select></font></p>
					
                <p><font size="2" face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  Kind: </font><font face="Verdana"> 
                  <select size="1" name="model">
                    <? if (strcmp ($make,"NONE") != 0)
					   { while($rowModel=mysql_fetch_assoc($qryModel))
					     {?>
                    <option selected> 
                    <?=$rowModel['model']?>
                    </option>
                    <?}
					   }?>
                  </select>
                  </font></p>
                <p><font face="Verdana"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size="2">&nbsp;&nbsp;&nbsp;&nbsp;Model 
                  :</font> 
                  <select size="1" name="select">
                    <? if (strcmp ($make,"NONE") != 0)
					   { while($rowModel=mysql_fetch_assoc($qryModel))
					     {?>
                    <option selected> 
                    <?=$rowModel['model']?>
                    </option>
                    <?}
					   }?>
                  </select>
                  </font><font face="Verdana"> </font></p>
                <p><font size="2" face="Verdana">&nbsp;No Pendaftaran :</font><font face="Verdana"> 
                  <input type="text" name="reg" size="20"></font></p>
					
                <p><font size="2" face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tahun 
                  : </font><font face="Verdana"> 
                  <select size="1" name="year">
					<?
					for ($i = 2007; $i >= 1960; $i--) 
					{echo "<option >$i</option>";}
					?></select></font></p>
					
                <p><font size="2" face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  Bil. Pemilik : </font><font face="Verdana"> 
                  <select size="1" name="owner"><?
					for ($i = 1; $i <= 5; $i++) 
					{echo "<option >$i</option>";}
					?></select></font></p>
					
                <p><font face="Verdana"><font size="2">Jumlah kilometer: </font> 
                  <input type="text" name="mileage" size="20"></font></p>
					
                <p><font face="Verdana"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  Harga : </font> 
                  <input type="text" name="price" size="20"></font></p>
					
                <p><font face="Verdana"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  Gambar : </font> 
                  <input type="file" name="image" size="20"></font></p>
					
                <p><font face="Verdana" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  Catatan :</font></p>
					<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<textarea rows="9" name="remark" cols="38"></textarea></font></p>
					<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="submit" value="Hantar" name="B1">&nbsp;&nbsp;
					<input type="reset" value="Padam" name="B2"></p>
				</form>
&nbsp;</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<p align="center"><font face="Verdana" size="2"><a href="adminhome.php">Menu Utama</a></font></td>
	</tr>
</table>

</div>

</body>

</html>
